/*
 * @Author: Await
 * @Date: 2025-04-17 15:22:10
 * @LastEditors: Await
 * @LastEditTime: 2025-04-18 17:16:18
 * @Description: 编辑器类型定义
 */
import { ChartConfig, ChartType } from './chartTypes';
import { DataConfig, DataSource } from './dataTypes';

/**
 * 编辑器状态接口
 */
export interface EditorState {
    currentChart: ChartConfig;
    dataConfig: DataConfig;
    dataSource: DataSource;
    previewMode: boolean;
    editingPart: 'data' | 'config' | 'style' | 'preview' | 'code';
    history: {
        past: ChartConfig[];
        future: ChartConfig[];
    };
    error?: string | null;
    loading: boolean;
}

/**
 * 消息类型
 */
export enum MessageType {
    DATA_UPDATE = 'DATA_UPDATE',
    CONFIG_UPDATE = 'CONFIG_UPDATE',
    THEME_CHANGE = 'THEME_CHANGE',
    READY = 'READY',
    ERROR = 'ERROR'
}

/**
 * iframe通信消息接口
 */
export interface IframeMessage {
    type: MessageType;
    payload: any;
    source?: string;
    timestamp?: number;
}
